<template>
  <div class="dynamic">

    <div>
      <template>
        <div v-if="datalist.list" style="line-height: 2em;color: #999;">截止:{{ datalist.list[0].inputTime | dateFMT }}</div>
      </template>
      <div class="data">
        <el-row :gutter="5">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <div style="color: #FF1110;">{{ confirmed }}</div>
              <div>累计确诊</div>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <div style="color: #791518;">{{ suspected }}</div>
              <div>累计疑似</div>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <div style="color: #555;">{{ dead }}</div>
              <div>累计死亡</div>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="5">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <div style="color: #34AD6D;">{{ cure }}</div>
              <div>累计治愈</div>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <div style="color: #CE2E42;">{{ severe }}</div>
              <div>累计重症</div>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <div style="color: #FFA453;">{{ outside }}</div>
              <div>境外输入</div>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>

    <div>
      <div style="line-height: 2em;color: #999;">国内病例</div>
      <div class="table_data">
        <el-row>
          <el-col :span="4"><div class="grid-content bg-purple"
          style="background-color: #f1f4ff">地区
            </div></el-col>
          <el-col :span="4"><div class="grid-content bg-purple-light"
          style="background-color: #fdf1f0;color: #fb3132;">确诊
          </div></el-col>
          <el-col :span="4"><div class="grid-content bg-purple"
          style="background-color: #faeffe;color: #cc4aef;">疑似
          </div></el-col>
          <el-col :span="4"><div class="grid-content bg-purple-light"
          style="background-color: #f4f4f4;color: #555;">死亡
          </div></el-col>
          <el-col :span="4"><div class="grid-content bg-purple"
          style="background-color: #f1f9f0;color: #1dab3f;">治愈
          </div></el-col>
          <el-col :span="4"><div class="grid-content bg-purple-light"
          style="background-color:#ebf3ff;color: #3184ff;">境外输入
          </div></el-col>
        </el-row>

        <el-row v-for="item in datalist.list" :key="item.id">
          <el-col :span="4"><div class="grid-content ">{{item.province}}
            </div></el-col>
          <el-col :span="4"><div class="grid-content ">{{item.confirmed}}
          </div></el-col>
          <el-col :span="4"><div class="grid-content ">{{item.suspected}}
          </div></el-col>
          <el-col :span="4"><div class="grid-content">{{item.dead}}
          </div></el-col>
          <el-col :span="4"><div class="grid-content ">{{item.cure}}
          </div></el-col>
          <el-col :span="4"><div class="grid-content">{{item.outside}}
          </div></el-col>
        </el-row>

      </div>
    </div>

    <div>
      <div style="line-height: 2em;color: #999;">最新进展</div>
      <div style="background-color:#f8f8f8;padding:10px;">
        <div style="margin-bottom:10px;" v-for='(item,index) in art.list' :key='item.id'>
          <div class="logo">
            <div></div>
            <div v-if='index == 0' class="tag">最新</div>
            <div style="font-weight: 700;">{{item.publishTime | dateFMT}}</div>
          </div>
          <div style="background-color:#fff;padding:10px;border-radius:5px;">{{item.title}}</div>
        </div>
      </div>
    </div>
    

  </div>
</template>


<script>
import moment from "moment";
import { mapActions, mapState, mapGetters } from "vuex";
export default {
  computed: {
    //js文件里面的page_query数据

    ...mapState("datalist", ["datalist"]),
    ...mapState("article", ["art"]),

    ...mapGetters("datalist", [
      "confirmed",
      "suspected",
      "dead",
      "cure",
      "severe",
      "outside"
    ])
  },

  data() {
    return {
      obj: {
        page: 1,
        pageSize: 1000
      },     
    };
  },
  created() {
    this.page_query(this.obj);
    
    // console.log(time);
    this.page_query_art({page:1,pageSize:20})
  },
   methods: {
    //辅助函数,帮助我们快速获取状态机中的变量或者方法
    //js文件里面的page_query方法
    ...mapActions("datalist", ["page_query"]),
    ...mapActions("article", ["page_query_art"]),

    
  
  }
};
</script>





<style scoped>
/* scoped用来防止不同组件之间相同类名的样式污染 */
.logo .tag{
  background-color: #f43b3b;
  color: #fff;
  padding: 3px;
  font-size: 12px;
  border-radius: 3px;
  height: 100%;
}
.logo div{
  float: left;
  margin-left: 5px;
}
.logo div:first-child{
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: #005dff;
  border-radius: 50%;
  margin-top:5px;
}
.logo{
  overflow: hidden;
  margin-bottom: 5px;
}
.data .grid-content div:first-child {
  /* color: #ff6900; */
  font-weight: 700;
  height: 45px;
  line-height: 45px;
}
.data .grid-content div:first-child:hover{

  font-size: 25px;

}
.data .grid-content div {
  text-align: center;
  line-height: 1.15;
  /* font-weight: 800; */
}
.data {
  margin-top: 10px;
}
.el-row {
  margin-bottom: 5px;
  /* &:last-child {
    margin-bottom: 0;
  } */
}
/* .dynamic >>> .el-col {
    border-radius: 4px;
    padding-right: 0;
  } */
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #fbf5ef;
}
.bg-purple-light {
  background: #e5e9f2;
}
.data .grid-content {
  border-radius: 4px;
  min-height: 100px;
}
.table_data .grid-content {
  min-height: 60px;
  text-align: center;
  line-height: 60px;
}

.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

</style>